import request from '@/utils/request'

const deviceApi = {
    Add: '/device/add',
    GetAll: '/device/devices',
    GetSecret: '/device/secret',
    Types: '/device/types',
    Topics:'/device/topic',
    Delete:'/device/delete'
}
export function addDevices (parameter) {
    return request({
      url: deviceApi.Add,
      method: 'post',
      data: parameter
    })
  }

  export function getAllDevices () {
    return request({
      url: deviceApi.GetAll,
      method: 'get'
    })
  }


  export function getDeviceTypes () {
    return request({
      url: deviceApi.Types,
      method: 'get'
    })
  }

  export function getSecret (id) {
    return request({
      url: deviceApi.GetSecret + "?id=" + id,
      method: 'get',
    })
  }

  export function getDeviceTopic (id) {
    return request({
      url: deviceApi.Topics + "?id=" + id,
      method: 'get',
    })
  }

  export function deleteDevice (id) {
    return request({
      url: deviceApi.Delete + "?id=" + id,
      method: 'get',
    })
  }
